perm filename OLBFTP.SAI[11,HE] blob
sn#651177 filedate 1982-04-01 generic text, type T, neo UTF8
BEGIN "FTP Program Image mode only 10→11" comment OLBFTP.SAI;
COMMENT Same thing as IFTP.SAI except it knows the tape was written in
ANSI-labelled format, and it doesn't skip the header words on
the file, since they're really part of the file;
DEFINE CRLF="('15&'12)",
CR ="'15",
LF ="'12",
! = "COMMENT ",
TIL="STEP 1 UNTIL";
REQUIRE "11UTIL.HDR[11,SYS]" SOURCE_FILE;
DEFINE TTYSET = "'047000400121";
DEFINE GETLIN = "'051300000000";
INTEGER chan; ! Channel number for I/O to RSX;
INTEGER dskchan; ! Channel number for 10 disk I/O;
EXTERNAL INTEGER _SKIP_;
INTEGER ARRAY buffer[1:256];
INTEGER talk10,char,i,j,k,l,brk,dum,eof,base,bufadr,bufptr;
STRING s,f1,fnam10,fext10,ppn10;
LABEL fin;
PROCEDURE parse10 (STRING s);
BEGIN
fnam10 ← fext10 ← NULL;
WHILE s=" " ∧ s ≠ NULL DO dum ← LOP(s); ! Strip off leading blanks;
WHILE s≠"." ∧ s≠"[" ∧ s≠NULL DO fnam10 ← fnam10 & LOP(s); ! Build up file name;
WHILE s≠"[" ∧ s≠NULL DO fext10 ← fext10 & LOP(s); ! Build up file extension;
IF s="[" THEN ppn10 ← s; ! Set ppn if present;
END;
! Begin here;
SETBREAK(1,crlf,NULL,"INS");
ALINIT(false); ! Assign the ELF, but don't care about ARM;
PRINT(crlf & "10-11 FTP Program"&crlf&crlf);
chan ← GETCHAN;
OPEN(chan,"TTY53",0,1,1,999,brk,dum);
QUICK_CODE
LABEL XIT,SETUP;
HRRI '13,SETUP; ! Command list to initialize the tty;
HRLI '13,-3; ! Number of commands;
TTYSET '13,0; ! Do it;
JRST XIT;
SETUP:
! '072453000001; ! Set TTY EXIST;
! '040453000005; ! Set tty speed = 1200 baud;
'001453000004; ! Set (XON &) NO ECHO;
'002453010000; ! Set TTY NO ARROW?;
'023453000001; ! Set TTY GAG;
XIT: END;
OUT(chan,"RUN OLBFTP/CKP=NO"&crlf);
WHILE INPUT(chan,1) = NULL DO ; ! Ignore echo from RSX;
WHILE (s←INPUT(chan,1)) = NULL ∨ s=">" DO ;
base ← CVO(s) LSH 6; ! Get address of Partition Base;
PRINT("Partition base = ",CVOS(base),crlf);
WHILE (s←INPUT(chan,1)) = NULL DO ;
bufptr ← CVO(s); ! Get address of buffer pointer;
PRINT("Buffer pointer = ",CVOS(bufptr),crlf);
bufptr ← base + bufptr;
dskchan ← GETCHAN;
OPEN(dskchan,"DSK",'10,19,0,0,0,eof);
WHILE TRUE DO ! Get file to ship over;
BEGIN
PRINT("*");
f1 ← INCHWL; ! Read file name;
IF f1 = NULL THEN
BEGIN
POKE(bufptr+4,0); ! Tell 11 we're finished;
CALL(0,"EXIT");
END;
PARSE10(f1);
LOOKUP(dskchan,fnam10 & fext10 & ppn10,i);
IF i THEN
BEGIN PRINT("ABORTED - Can't find:",fnam10,fext10,ppn10,crlf); GO TO fin END;
POKE(bufptr+2,1); ! Tell 11 we're ready to start;
eof ← FALSE;
DO BEGIN ! Start transferring characters to the 11;
FOR i ← 1 STEP 2 UNTIL 255 DO ! Read in the next 256 words for the 11;
BEGIN
k ← WORDIN(dskchan); ! Get next 4 bytes;
j ← POINT(8,k,7);
buffer[i] ← LDB(j) + (ILDB(j) LSH 8); ! First word;
buffer[i+1] ← ILDB(j) + (ILDB(j) LSH 8); ! Second word;
END;
WHILE (bufadr←PEEK(bufptr))=0 DO CALL(0,"SLEEP"); ! Sleep for 1 tick;
IF bufadr LAND 1 THEN ! Something's wrong - abort;
BEGIN
PRINT("Error while writing file"&crlf);
GO TO fin;
END;
bufadr ← bufadr + base;
POKEARRAY(bufadr,256,buffer,0); ! Transfer the sector over;
POKE(bufptr,0); ! Tell 11 to write it out;
END UNTIL eof;
POKE(bufptr+2,0); ! Tell 11 we're all done;
fin:
CLOSE(dskchan);
END;
END;